import Vue from 'vue';
import router from './router';
import store from './store';
import App from './App';
import Directives from './directives/index'; // 自定义指令
Vue.use(Directives);
import uploader from 'vue-simple-uploader';
Vue.use(uploader);
// 打印
import print from './utils/print.js';
Vue.use(print);
// 电子签名
import vueEsign from 'vue-esign';
Vue.use(vueEsign);
import * as echarts from 'echarts';
Vue.prototype.$echarts = echarts;
import hevueImgPreview from 'hevue-img-preview';
import 'hevue-img-preview/css/theme-dark.css';
Vue.use(hevueImgPreview, {
  keyboard: true,
  clickMaskCLose: true,
  multiple: true
});
import 'amfe-flexible'; // rem h5 适配
import './styles/iconfont.less'; // 引入字体图标
import './styles/normalize.less'; // 引入全局主题样式文件
import VConsole from 'vconsole';
if (process.env.NODE_ENV === 'development') {
  const vConsole = new VConsole(); // 不使用的时候，可以将这句屏蔽掉；
  Vue.use(vConsole); // 增加 loading
}
// 注册高德
import VueAMap from 'vue-amap';
const amapKeys = Object.keys(localStorage).filter(key => key.match(/^_AMap_/));
amapKeys.forEach(key => {
  // console.log(key)
  localStorage.removeItem(key);
});
Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
  key: '00cbb54bf76bb4ccdf78c7b48d54020b', // 这里是你的高德开发者key
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  v: '1.4.4'
});
import moment from 'moment';
Vue.prototype.$moment = moment;
import 'vant/lib/index.css';
import { Button, NavBar, Cell, CellGroup, Divider, Sticky, List } from 'vant';
[Button, NavBar, Cell, CellGroup, Divider, Sticky, List].forEach(each => {
  Vue.use(each);
});
// 全局注册过滤器
import * as filters from './utils/Filter';
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});
Vue.config.productionTip = false;
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
});
